﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SkillManager {

    int skillID;
    int skillDamage;
    int skillRangeDamage;
    float skillRange;
   // bool isSkillRange;
    GameObject playerObj;
    float skillCD;
    SummonAnimal summonAnimal;

    public enum SkillType
    {
        VERTIGE,
        AOE
    }

    public SkillManager(int Id,int damage,float range,float cd,GameObject player)
    {
        skillID = Id;
        skillDamage = damage;
        skillRange = range;
       
        skillCD = cd;
        playerObj = player;
        summonAnimal = playerObj.GetComponent<SummonAnimal>();
    }

    public void Skill()
    {
        switch (skillID)
        {
            case 1:

                //怪物受到技能时扣除血量
                //怪物受到攻击时影响的属性
                break;
            case 2:
                break;
            default:
                break;
        }
    }


    GameObject enemyManager;

    //范围技能
    void SkillRange(GameObject enemy)
    {
        //技能范围攻击
        SummonAnimal enemySA = enemy.GetComponent<SummonAnimal>();
        enemySA.HP -= skillDamage;
        int count = enemyManager.transform.childCount;
        for (int i=0; i<count;i++)
         {
            float distance = Vector3.Distance(enemyManager.transform.GetChild(i).position, enemy.transform.position);
            if (distance < skillRange)
             {
                enemyManager.transform.GetChild(i).GetComponent<SummonAnimal>().HP -= skillRangeDamage;
                    //周边怪物受技能影响
             }
         }
    }


    //单体技能
    void SkillMonomer(GameObject enemy)
    {
        SummonAnimal enemySA = enemy.GetComponent<SummonAnimal>();
        enemySA.HP -= skillDamage;
        //状态修改
    }
}
